package com.example.springstudyvue.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springstudyvue.entity.Category;
import com.example.springstudyvue.mapper.CategoryMapper;
import com.example.springstudyvue.service.CategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author linKe
 * @since 2021-11-26
 */
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements CategoryService {
    @Resource
    private CategoryMapper categoryMapper;

    @Override
    public Boolean addCategory(Category category) {
        return categoryMapper.insert(category) > 0;
    }

    @Override
    public Boolean updateCategory(Category category) {
        return categoryMapper.updateById(category) > 0;
    }

    @Override
    public boolean deleteCategory(Long categoryId) {
        return categoryMapper.deleteById(categoryId) > 0;
    }
}
